import org.junit.jupiter.api.Test;
import utils.random_.RandomUtil;
import utils.scanner_.ScannerUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import static utils.collection_.CollectionUtil.*;

/**
 * @Description: 测试程序
 * @CreateTime: 2024-01-16  13:58
 * @Author: JAMILA
 * @Version: 1.0
 */

public class TestMain {

    @Test
    public void testRandomUtil(){
        for (int i = 0; i < 20; i++) {
            System.out.println(RandomUtil.getVerificationCode6());
        }
    }

    @Test
    public void testScannerUtil(){
        System.out.println("请输入");
        int i = ScannerUtil.readInt();
        System.out.println("i="+i);

    }

    @Test
    public void testCollectionUtil1(){
        Integer [] myArray = { 1, 2, 3 };
        System.out.println(arrayToList(myArray).getClass());//class java.util.ArrayList
        List<Integer> list = arrayToList(myArray);
        list.add(8);
        list.forEach(System.out::println);
    }


    @Test
    public void testCollectionUtil2(){
        List<String> list=new ArrayList<>();
        list.add("张三");
        list.add("李四");
        list.add("王五");
        list.add("李四");
        System.out.println("去重前："+list);
        List<String> list1 = removeDuplicateByList(list);
        System.out.println("List去重后："+list1);
        Set<String> stringSet = removeDuplicateBySet(list);
        System.out.println("Set去重后："+stringSet);
    }


}
